import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const BackgroundMeta: IPublicTypeComponentMetadata = {
  componentName: 'Background',
  title: '顶部背景',
  category: '布局',
  group: '通用组件',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'Background',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '高度'
    },
    {
      name: 'opacity',
      propType: 'number',
      description: '透明度'
    },
    {
      name: 'responsive',
      propType: 'bool',
      description: '响应式'
    },
    {
      name: 'children',
      propType: 'node',
      description: '子组件'
    }
  ],
  configure: {
    props: [
      {
        name: 'width',
        title: { label: { type: 'i18n', 'en-US': 'width', 'zh-CN': '宽度' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 3952 }
      },
      {
        name: 'height',
        title: { label: { type: 'i18n', 'en-US': 'height', 'zh-CN': '高度' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 1248 }
      },
      {
        name: 'opacity',
        title: { label: { type: 'i18n', 'en-US': 'opacity', 'zh-CN': '透明度' } },
        setter: { 
          componentName: 'NumberSetter', 
          isRequired: false, 
          initialValue: 1,
          props: {
            min: 0,
            max: 1,
            step: 0.1
          }
        }
      },
      {
        name: 'responsive',
        title: { label: { type: 'i18n', 'en-US': 'responsive', 'zh-CN': '响应式' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      },
      {
        name: 'className',
        title: { label: { type: 'i18n', 'en-US': 'className', 'zh-CN': '自定义类名' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '' }
      }
    ],
    supports: {
      style: true,
      className: true
    },
    component: {
      isContainer: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '顶部背景',
    screenshot: '',
    schema: {
      componentName: 'Background',
      props: {
        width: 3952,
        height: 186,
        opacity: 1,
        responsive: true
      },
      children: []
    }
  }
];

export default {
  ...BackgroundMeta,
  snippets
};